<page-header-wrapper title="接口权限"></page-header-wrapper>

<nz-card class="search-box">
    <div nz-row nzGutter="8">
        <div nz-col [nzSpan]="6">
            <sf #sf [schema]="searchSchema" [ui]="{ '*': { spanLabelFixed: 90,grid: { span: 24 } }}" [compact]="true"
                [button]="'none'"></sf>
        </div>
        <div nz-col [nzSpan]="8" nzOffset="1">
            <button nz-button nzType="primary" [nzLoading]="service.http.loading"
                (click)="loadMemu(selectedPlatform.appId)">查询</button>
            <button nz-button (click)="resetSF()">重置</button>
            <!-- <button nz-button (click)="delMenu(0)" [nzLoading]="service.http.loading">
        清空货主菜单
      </button>
      <button nz-button (click)="delMenu(1)" [nzLoading]="service.http.loading">
        清空运营后台菜单
      </button> -->
        </div>
    </div>
</nz-card>

<nz-card class="content-box">

    <nz-tabset>
        <nz-tab nzTitle="货主菜单" (nzClick)="changeMemu(0)" *ngIf="isShowFre"></nz-tab>
        <nz-tab nzTitle="运营后台菜单" (nzClick)="changeMemu(1)" *ngIf="isShowBackEND"></nz-tab>
    </nz-tabset>

    <!-- <st #st [data]="service.$api_get_all" [columns]="columns" [expand]="expand" expandRowByClick
    [req]="{ method: 'POST',  reName: { pi: 'pageIndex', ps: 'pageSize' },params:{appId:selectedPlatform?.appId} }"
    [res]="{ reName: { list: 'data' } }" [page]="{ show: false }" [loading]="false"
    [scroll]="{ y: '370px' }" (change)="stChange($event)">
    <ng-template #expand let-item let-index="index" let-column="column">
      {{ item.description }}
    </ng-template>
  </st> -->
    <nz-table #expandTable [nzData]="listOfMapData" nzTableLayout="fixed" nzBordered nzSize="small"
        [nzLoading]="service.http.loading" *ngIf="isShowFre || isShowBackEND">
        <thead>
            <tr>
                <!-- <th nzWidth="70px" nzAlign="center">#</th> -->
                <th>菜单名称</th>
                <th>菜单编号</th>
                <th>路由地址</th>
                <th nzAlign="center" nzWidth="120px">菜单图标</th>
                <th nzWidth="100px">菜单排序</th>
                <th nzWidth="150px" nzAlign="center">操作</th>
            </tr>
        </thead>
        <tbody>
            <ng-container *ngFor="let data of expandTable.data">
                <ng-container *ngFor="let item of mapOfExpandedData[data.key];let i = index">
                    <tr *ngIf="(item.parent && item.parent.expand) || !item.parent">
                        <!-- <td nzWidth="70px" nzAlign="center" [nzChecked]="item.checked">{{ i+1 }}</td> -->
                        <td [nzIndentSize]="item.level! * 20" [nzShowExpand]="!!item.children"
                            [(nzExpand)]="item.expand"
                            (nzExpandChange)="service.collapse(mapOfExpandedData[data.key], item, $event)">
                            {{ item.text }}
                        </td>
                        <td>{{ item.keyCode }}</td>
                        <td>{{ item.link }}</td>
                        <td nzAlign="center" nzWidth="120px">
                            <i nz-icon [nzType]="item.iconType"></i>
                        </td>
                        <td nzWidth="100px">{{ item.sorted }}</td>
                        <td nzWidth="150px" nzAlign="center">
                            <a (click)="openDrawer(item)" acl [acl-ability]="['MENU-AUTH-auth']">权限配置</a>
                        </td>
                    </tr>
                </ng-container>
            </ng-container>
        </tbody>
    </nz-table>
</nz-card>